package cn.wilson.hrm.feign.client;

import cn.wilson.hrm.feign.fallback.RedisFeignClientFallbackFactory;
import cn.wilson.hrm.utils.AjaxResult;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

//用来调用缓存服务feign的接口
@FeignClient(value = "CACHE-SERVER",fallbackFactory = RedisFeignClientFallbackFactory.class)
public interface RedisFeignClient {


    @RequestMapping(value = "/redis/set",method = RequestMethod.POST)
    AjaxResult set(@RequestParam("key") String key, @RequestParam("value")String value);

    @RequestMapping(value = "/redis/setex",method = RequestMethod.POST)
    AjaxResult setex(@RequestParam("key") String key,@RequestParam("seconds") int seconds,@RequestParam("value")String value);

    @RequestMapping(value = "/redis/get/{key}",method = RequestMethod.GET)
    AjaxResult get(@PathVariable("key") String key);

    @RequestMapping(value = "/redis/reset/{key}",method = RequestMethod.POST)
    AjaxResult reSet(@PathVariable("key") String key);
}
